package com.icangya.DAO.impl;

import com.icangya.DAO.IFbBackMissionDAO;
import com.icangya.DAO.IFbTipDAO;
import com.icangya.domain.FbBackMission;
import com.icangya.domain.FbTip;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class FbBackMissionDAOImpl extends  BaseDAO<FbBackMission> implements IFbBackMissionDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public List<FbBackMission> getFbBackMission() {
        String hql="FROM FbBackMission bm";

        return (List<FbBackMission>) getHibernateTemplate().find(hql);
    }

    @Override
    public FbBackMission getMissionByMissionId(long missionId) {

        String hql="FROM FbBackMission bm where bm.missionId=?";

        List<FbBackMission>  list= (List<FbBackMission>) getHibernateTemplate().find(hql,missionId);

        if(list.size()>0)
            return list.get(0);
        return null;
    }

}
